<?php
/**
 * Smart Library - Smart Framework
 * http://smart-framework.highet.eu
 *
 * @category   SmartL
 * @package    SmartL_Zend
 * @subpackage Controller
 * @copyright  Copyright (c) 2005-2008 Smart Framework team - Stepan Sindelar, Vojtech Vit
 * @license    http://www.opensource.org/licenses/bsd-license.php	New BSD License
 */

/**
 * This is intarface for data adapter.
 *
 * In most cases is better to cache results of some methods calls inside class
 * or eventually in some real cache.
 *
 * For example if somebody wants to call addUrl, he should call methods urlExists and
 * requestExists to avoid exceptino thrown due to duplicity, but these methods are also called
 * with same parameters inside method addUrl to again check duplicity.
 *
 * @package SmartL_Zend
 * @subpackage Controller
 */
interface SmartL_Zend_Controller_Router_UrlTable_DataAdapter_Interface {
	/**
	 * Returns true if given url exists in data store.
	 *
	 * @param string $url
	 */
	public function urlExists($url);
	
	/**
	 * If given request exists, returns true.
	 *
	 * @param string $controller
	 * @param string $action
	 * @param array[string paramName]=>value $params
	 */
	public function requestExists($controller, $action, $params);
	
	/**
	 * Returns data of request assigned to given url.
	 *
	 * @param sring $url
	 * @return SmartL_Application_Config_RequestInfo
	 */
	public function getRequest($url);
	
	/**
	 * Returns url assigned to given request
	 *
	 * @param string $controller
	 * @param string $action
	 * @param array $params
	 */
	public function getUrl($controller, $action, $params);
	
	/**
	 * Adds url to data storage.
	 *
	 * @param string $url
	 * @param string $controller
	 * @param string $action
	 * @param array[string]=>string $params
	 * @throws SmartL_Zend_Controller_Router_UrlTable_DataAdapter_{ClassName}_Exception
	 * When the given url of request exists.
	 */
	public function addUrl($url, $controller, $action, $params);
	
	/**
	 * Remove given url data from data store.
	 *
	 * @param string $url
	 */
	public function removeUrl($url);
}